package com.zdb.demo.design.pattern.creational.prototype;

public class Test {
    public static void main(String[] args) throws CloneNotSupportedException {
        Mail mail = new Mail();
        mail.setContent("内容模板");
        System.out.println("初始mail:" + mail);
        for (int i = 0; i < 100; i++) {
            Mail mailTmp = (Mail) mail.clone();
            mailTmp.setName("name_" +i);
            mailTmp.setAddress("addr_" + i + "@qq.com");
            mailTmp.setContent("恭喜name_" +i + "中奖");
            System.out.println("克隆mail:" + mailTmp);
            MailUtil.sendMail(mailTmp);
        }
        MailUtil.saveOriginMailRecord(mail);
    }
}
